<%--
  Created by IntelliJ IDEA.
  User: user
  Date: 2023/4/27
  Time: 9:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户信息管理</title>
    <link rel="stylesheet" href="../../../static/bootstrap-3.3.6-dist/css/bootstrap.min.css">
    <script src="../../../static/jquery-1.12.4/jquery-1.12.4.js"></script>
    <script src="../../../static/bootstrap-3.3.6-dist/js/bootstrap.js"></script>
</head>
<body>
<form action="/getUserInfoes">
    <button class="btn btn-primary">查询</button>
    <button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal">
       新增
    </button>
</form>

<c:if test="${userinfoes!=null}">
<table class="table table-hover">
       <thead>
        <tr>
           <th>序号</th>
            <th>用户名</th>
            <th>密码</th>
            <th>家庭住址</th>
            <th>联系方式</th>
            <th>操作</th>
        </tr>
       </thead>
        <tbody>
        <c:forEach items="${userinfoes}" var="eachUser" varStatus="status">
            <tr>
                <td>${status.index+1}</td>
                <td>${eachUser.username}</td>
                <td>${eachUser.userpwd}</td>
                <td>${eachUser.useraddress}</td>
                <td>${eachUser.usertel}</td>
                <td>
                    <a class="btn btn-success" href="/showUserInfoById?userid=${eachUser.id}">编辑</a>
                    <a class="btn btn-danger" href="/deleteUserInfo?userid=${eachUser.id}">删除</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</c:if>
<!-- 用户信息新增模态框 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form action="/addUserInfo">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">用户信息新增</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label for="exampleInputEmail1">用户名</label>
                        <input type="text" name="username" class="form-control" id="exampleInputEmail1" placeholder="请输入用户名">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">密码</label>
                        <input type="password" name="userpwd" class="form-control" id="exampleInputPassword1" placeholder="请输入密码">
                    </div>
                    <div class="form-group">
                        <label for="usertel">联系方式</label>
                        <input type="text" name="usertel" class="form-control" id="usertel" placeholder="请输入联系方式">
                    </div>
                    <div class="form-group">
                        <label for="useaddress">家庭住址</label>
                        <input type="text" name="useraddress" class="form-control" id="useaddress" placeholder="请输入家庭住址">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary">保存</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>

</html>
